home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / ntkb.zip / NTKB.EXE / Q99 / 7 / 07.TXT next >
Text File  |  1993-09-28  |  5KB  |  118 lines

  1. DOCUMENT:Q99707  24-SEP-1993  [W_NT]
  2. TITLE   :How Windows NT Provides 4 Gigabytes of Memory
  3. PRODUCT :Windows NT
  4. PROD/VER:3.10
  5. OPER/SYS:WINDOWS
  6. KEYWORDS:
  7.  
  8. --------------------------------------------------------------------
  9. The information in this article applies to:
  10.  
  11.  - Microsoft Windows NT operating system version 3.1
  12. --------------------------------------------------------------------
  13.  
  14. Windows NT has an addressable memory space of four gigabytes. This is
  15. considered a virtual memory space as most computers do not have the
  16. physical RAM to actually contain four gigabytes of data. Because of
  17. the services provided by the Windows NT virtual memory manager,
  18. programs can be written to exploit large amounts of memory without
  19. being concerned with the type of memory or the amount available. The
  20. Windows NT virtual memory manager provides this large, virtual memory
  21. space to applications via two memory management processes: moving data
  22. between physical RAM and the hard disk or paging, and translating
  23. physical memory addresses to virtual memory addresses or mapped file
  24. I/O.
  25.  
  26. PAGING
  27. ======
  28.  
  29. When a file is larger than the size of your available system RAM, the
  30. virtual memory manager uses paging to move data between RAM and the
  31. hard disk. It accomplishes this by dividing all physical memory and
  32. virtual memory (the memory used by applications) into equal sized
  33. blocks or pages (4K each). When a request is made to access data that
  34. is not in RAM, the virtual memory manager swaps a page from RAM with
  35. the desired page from the paging file (a file on the hard disk used
  36. solely by the virtual memory manager for extra data storage).
  37.  
  38. Page states are registered in a virtual page table. If a page is in
  39. RAM and is immediately available to its process (or program), it is
  40. marked as valid. Pages that have been moved to the paging file are
  41. marked as invalid. When a process tries to access an invalid page, the
  42. central processing unit (CPU) generates a page fault. The virtual
  43. memory manager traps page faults and retrieves pages from the paging
  44. file. If there is no room in RAM to store a new page, a valid page is
  45. moved out.
  46.  
  47. PAGING POLICIES
  48. ===============
  49.  
  50. There are three policies used by the virtual memory manager to
  51. determine how and when paging is performed:
  52.  
  53. Fetch
  54. -----
  55.  
  56. A demand-based paging algorithm is used to retrieve (or fetch) memory
  57. pages. The virtual memory manager waits until a process thread
  58. attempts to access an invalid page before loading the page into RAM.
  59. Because page faults and disk access are both somewhat slow, additional
  60. pages are loaded along with the desired page in a process called
  61. clustering. The additional pages are chosen by their proximity to the
  62. desired page, the theory being that the process may need information
  63. that spans several consecutive pages. This reduces the number of page
  64. faults generated and the amount of disk operations.
  65.  
  66. Placement
  67. ---------
  68.  
  69. Placement refers to the location a page is stored in RAM. The virtual
  70. memory manager chooses the first free page in RAM it finds.
  71.  
  72. Replacement
  73. -----------
  74.  
  75. If the placement policy fails because there are no free pages in RAM,
  76. the replacement policy is used to determine which page will be moved
  77. from RAM to the paging file. Each process has a group of valid pages
  78. in RAM; these are called the working set. For simplicity, a first-in,
  79. first-out (FIFO) algorithm is used. When a page replacement is
  80. required, the oldest page in the working set is moved to the paging
  81. file to make room for the new page. Because the replacement scheme is
  82. only applied to the working set of the current process, other
  83. processes are guaranteed that their pages will not be replaced by
  84. other processes.
  85.  
  86. MAPPED FILE I/O
  87. ===============
  88.  
  89. If an application attempts to load a file that is larger than both the
  90. system RAM and the paging file combined, the mapped file I/O services
  91. of the virtual memory manager are used. Mapped file I/O enables the
  92. virtual memory manager to map virtual memory addresses to a large
  93. file, inform the application that the file is available, and then load
  94. only the pieces of the file that the application actually intends to
  95. use. Because only portions of the large file are loaded into memory
  96. (RAM or page file), this greatly decreases file load time and system
  97. resource drainage. This is a very useful service for database
  98. applications that often require access to huge files.
  99.  
  100. Additional reference words: 3.10
  101. KBCategory:
  102. KBSubCategory: FILSYS 
  103.  
  104. =============================================================================
  105.  
  106. THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS
  107. PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.  MICROSOFT DISCLAIMS
  108. ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES
  109. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
  110. EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR
  111. ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
  112. CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF
  113. MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE
  114. POSSIBILITY OF SUCH DAMAGES.  SOME STATES DO NOT ALLOW THE EXCLUSION
  115. OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES
  116. SO THE FOREGOING LIMITATION MAY NOT APPLY.
  117.  
  118. Copyright Microsoft Corporation 1993.